package com.eos.control.action.activity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.business.service.SysProductBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.ActivtyMappModel;
import com.eos.orm.mybatis.model.ProductBrand;
import com.eos.orm.mybatis.model.ProductModel;
import com.eos.orm.mybatis.model.SysProduct;
import com.hf.utils.PaginationBean;

public class ShowActivityModelAction extends AbstractBaseAction {
	private static final long serialVersionUID = 4583489340567635786L;
	//private String activtyId;
	private String activtySonId;
	private String dealFlag;
	private Integer pageNum;
	private Integer numPerPage;
	private Integer totalCount;
	private List<ActivtyMappModel> activtyModelList;
	private List<SysProduct> productList;
	private List<ProductBrand> brandList;
	private List<ProductModel> modelList;
 

	public String getActivtySonId() {
		return activtySonId;
	}

	public void setActivtySonId(String activtySonId) {
		this.activtySonId = activtySonId;
	}

	/*public String getActivtyId() {
		return activtyId;
	}
	
	public void setActivtyId(String activtyId) {
		this.activtyId = activtyId;
	}*/

	public String getDealFlag() {
		return dealFlag;
	}

	public void setDealFlag(String dealFlag) {
		this.dealFlag = dealFlag;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(Integer numPerPage) {
		this.numPerPage = numPerPage;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	public List<ActivtyMappModel> getActivtyModelList() {
		return activtyModelList;
	}

	public List<SysProduct> getProductList() {
		return productList;
	}

	public List<ProductBrand> getBrandList() {
		return brandList;
	}

	public List<ProductModel> getModelList() {
		return modelList;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String execute() {
		try {
			if (pageNum == null || pageNum.intValue() == 0)
				pageNum = 1;
			if (numPerPage == null || numPerPage.intValue() == 0)
				numPerPage = PAGE_SIZE;
			SysActivityBusinessService sabs = new SysActivityBusinessService();
			Map<String, String> map = new HashMap<String, String>();
			map.put("page_size", numPerPage + "");
			map.put("cur_page", pageNum + "");
			map.put("deal_flag", dealFlag);
			//map.put("activty_id", activtyId);
			map.put("activty_son_id", activtySonId);
			map.put("table_name", "activty_mapp_model");
			PaginationBean pageBean = sabs.getActivityModelList(map);
			totalCount = null != pageBean ? pageBean.getMaxcount() : 0;
			activtyModelList = null != pageBean ? (List<ActivtyMappModel>) pageBean.getResultList() : null;
			
			
			 SysProductBusinessService spas = new SysProductBusinessService();
			 ProductBrand proBrand = new ProductBrand();
			 proBrand.setStatus(ConstantTool.STATUS_OK);
			 proBrand.setDealFlag(ConstantTool.DEAL_FALG_OK);
			 brandList = spas.getProductBrandExample(proBrand);
			
			 SysProduct sysProduct = new SysProduct();
			 sysProduct.setDealFlag(ConstantTool.DEAL_FALG_OK);
			 sysProduct.setStatus(ConstantTool.STATUS_OK);
			 productList = spas.getSysProductExample(sysProduct);
			 
			 ProductModel pm = new ProductModel();
			 pm.setStatus(ConstantTool.STATUS_OK);
			 pm.setDealFlag(ConstantTool.DEAL_FALG_OK);
			 modelList = spas.getProductModelExample(pm);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
